package com.xjmall.controller.portal;

import com.github.pagehelper.PageInfo;
import com.xjmall.common.ServerResponse;
import com.xjmall.service.ICommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by An on 2017/8/13.
 */
@Controller
@RequestMapping("/comment/")
public class CommentController {

    @Autowired
    private ICommentService iCommentService;

    /**
     * 根据商品id查询商品评论列表
     * @param productId
     * @param pageNum
     * @param pageSize
     * @return
     */
    @RequestMapping("list.do")
    @ResponseBody
    public ServerResponse<PageInfo> selectCommentList(Integer productId, @RequestParam(value = "pageNum",defaultValue = "1") int pageNum,
                                                     @RequestParam(value = "pageSize",defaultValue = "10") int pageSize) {
        return iCommentService.selectByProductId(productId, pageNum, pageSize);
    }
}
